"""
 @Author: Envision
 @Github: ElapsingDreams
 @Gitee: ElapsingDreams
 @Email: None
 @FileName: example.py
 @DateTime: 2024/3/8 20:48
 @SoftWare: PyCharm
"""
import os

from MusicPreview.main import PreviewMusic
import time

if __name__ == '__main__':
    # 没测试其他midi，
    # user_file路径编写示例 E:\work\PreviewMusic\example.mid
    # user_out_path路径编写示例 E:\work\PreviewMusic
    user_file = r"E:\Work2024\test-midi\Creator - Lena Raine - Minecraft.mid"
    user_out_path = r"E:\Work2024\test-midi"
    # mode:
    # 0-OriginLength
    # 1-use_mc_player_define
    # 2-matchMIDI-cut
    # 3-matchMixing
    # 4-matchMIDI-TSM
    mode = 0
    # default_channel_num
    # 双声道转单声道时，选取左还是右声道，1左2右
    default_channel_num = 1
    # overlay_channels
    # 1单声道 2双声道
    overlay_channels = 1
    # gvm get value method
    # 0均值 1钳位
    gvm = 0
    t1 = time.time()
    # user_file = r"*.mid"
    # user_out_path = r""

    to_music = PreviewMusic(usr_input_path=user_file, usr_output_path=user_out_path, mode=mode, gvm=gvm,
                            default_channel_num=default_channel_num, overlay_channels=overlay_channels, out_sr=44100)
    t2 = time.time()
    print(f"初始化{t2 - t1}s")
    t1 = time.time()
    to_music.to_wav_file()
    t2 = time.time()
    print(f"叠加输出{t2 - t1}s")
